<template>
	<view class="chat-list">
		<view v-for="(item, index) in curMessageList" :key="index" class="">
			<message-right v-if="item.senderUserID == userInfo.id" :key="index" :item="item"
				:type="JSON.parse(item.extendedData).type.toString()"></message-right>

			<message-left v-else :item="item" :type="JSON.parse(item.extendedData).type.toString()"
				:avatar="conversationObj.userAvatarUrl ? conversationObj.userAvatarUrl : 'https://api.xiaozhucaishui.com/assets/img/avatar.png'"
				:name="conversationObj.baseInfo.userName"></message-left>
		</view>
	</view>
</template>

<script>
import messageLeft from "@/enterpriseServer/chatRoom/components/messageLeft.vue";
import messageRight from "@/enterpriseServer/chatRoom/components/messageRight.vue";
export default {
	name: 'chatList',
	components: {
		messageLeft,
		messageRight,
	},
	props: {
		curMessageList: {
			type: Array,
			default: () => {
				return [];
			},
		},
		conversationObj: {
			type: Object,
			default: () => {
				return {};
			},
		},
	},
	data() {
		return {
			userInfo: null,
		};
	},
	watch: {

	},

	created() {
		this.userInfo = this.$store.state.userInfo
	},

	mounted() {

	},

	methods: {

	}
};
</script>

<style lang="scss" scoped>
.chat-list {
	padding: 30rpx 0;
}
</style>